function DistApp=SteadyState_DistApp(PP,SS)

%% Preliminary

%% Entrant Distribution
%--------------------------------------------------------------------------
% Entrant Distribution Parameters 
%--------------------------------------------------------------------------
EntDistParam=   struct('f',struct('MU',0,'SIG',0));

%% Support Boundary
if isfield(SS,'SimuSample')
    SimuSample  =   struct('f',SS.SimuSample.StateMat(:,1));
    TempList    =   {'f'};
    SimuLimit   =   struct();
    for ii=1:length(TempList)
        tt          =   TempList{ii};
        SimuLimit.(tt)= [min(SimuSample.(tt)),max(SimuSample.(tt))];
        SimuLimit.(tt)= SimuLimit.(tt)+0.05*abs(diff(SimuLimit.(tt)(:)))*[-1,1];
    end
    SupportLimit=   struct('f',[max(SimuLimit.b(1),SS.FunApp.V.UnitLimit(1,1)),...
                                min(SimuLimit.b(2),SS.FunApp.V.UnitLimit(1,2))] ...
                           );
else
    SupportLimit=   struct('f',SS.FunApp.V.UnitLimit(1,:));
end

%% Distribution Approximation Scheme
%-------------------------------------------------------------------------- 
% Support Nodes and Breaks
%--------------------------------------------------------------------------
DimList     =   {'f'};
DimNum      =   length(DimList);
UnitBreaks  =   struct();
UnitNode    =   struct();
UnitNum     =   struct();

UnitBreaks.f=   VecFun_MakeLogDiffGrid(SupportLimit.f(1),...
                                       SupportLimit.f(2),...
                                       PP.DistAppStruct.f.N-1,...
                                       PP.DistAppStruct.f.BreakCurvature)';
if PP.KAPPA>0
    UnitBreaks.f=   sort([UnitBreaks.f(UnitBreaks.f<0);0;0;UnitBreaks.f(UnitBreaks.f>0)]);
end
TransFun.f.toLogDiff ...
            =   @(f)VecFun_LogDiffGridConversion(SupportLimit.f(1),SupportLimit.f(2),...
                                                 PP.DistAppStruct.f.N-1,PP.DistAppStruct.f.BreakCurvature,...
                                                 f,'LinDiff');
TransFun.f.fromLogDiff ...
            =   @(f)VecFun_LogDiffGridConversion(SupportLimit.f(1),SupportLimit.f(2),...
                                                 PP.DistAppStruct.f.N-1,PP.DistAppStruct.f.BreakCurvature,...
                                                 f,'LogDiff');
                                             
% TransFun.f.toLogDiff ...
%             =   @(f)f;
% TransFun.f.fromLogDiff ...
%             =   @(f)f;
for ii=1:DimNum
    dd          =   DimList{ii};
    TempBreaks  =   TransFun.(dd).fromLogDiff(UnitBreaks.(dd));
    TempNode    =   [TempBreaks(1);...
                     (TempBreaks(1:end-1)+TempBreaks(2:end))/2;...
                     TempBreaks(end)];
    UnitNode.(dd) ...
                =   TransFun.(dd).toLogDiff(unique(TempNode));
    UnitNum.(dd)=   length(UnitNode.(dd));
   
end
%-------------------------------------------------------------------------- 
% Approximation Structures
%--------------------------------------------------------------------------
DistApp.fz  =   DistAppClass({'f','z'}, ...
                             {'Continuous','Discrete'},...
                             {UnitBreaks.f,[]},...
                             {UnitNode.f,SS.FunApp.ExoState.IndNode});
DistApp.TransFun ...
            =   TransFun;

%% Constant Matrix and Vectors

%--------------------------------------------------------------------------
% Exit and Entry: Flow QW from Entrants
%--------------------------------------------------------------------------
QW_z        =   MarkovChain_InvDist(SS.FunApp.ExoState.TrMat);
QW_f        =   DistApp_Hist_TrMatApprox(DistApp.TransFun.f.fromLogDiff(DistApp.fz.UnitNode{1}), ...
                                         DistApp.TransFun.f.fromLogDiff(0));
QW          =   prod(gridmake(QW_f,QW_z),2);
UnitQW      =   {QW_f;QW_z};

DistApp.Entrant ...
            =   struct('QW',QW,'UnitQW',{UnitQW},'DistParam',EntDistParam);
%--------------------------------------------------------------------------
% State for Policy
%--------------------------------------------------------------------------
PolicyState =   gridmake(DistApp.fz.UnitNode{1},SS.FunApp.ExoState.IndNode);
DistApp.Const ...
            =   struct('FlowQW_Entry_U',PP.XI*QW,...
                       'PolicyState',PolicyState);

        
